package com.ch08;

/**
 * @ClassName People
 * @Description 单例模式(饿汉式写法)
 * @Author Kx
 * @Date 2025/4/17 14:52
 * @Version 1.0
 */
public class People {
    /***
     * @author: kx
     * @date: 2025/4/17 14:53
     * @description: 类开始加载的时候就创建一个静态实例
    */
    private static final People people = new People();

    /***
     * @author: kx
     * @date: 2025/4/17 14:53
     * @description: 私有化构造方法
    */
    private People(){

    }

    /***
     * @author: kx
     * @date: 2025/4/17 14:54
     * @return com.ch08.People : 静态实例
     * @description: 提供一个公共静态方法，返回实例
    */
    public static People getInstance(){
        return people;
    }
}
